yum install -y openstack-cinder targetcli python-oslo-db MySQL-python scsi-target-utils


systemctl enable lvm2-lvmetad.service
systemctl start lvm2-lvmetad.service

openstack-config --set /etc/cinder/cinder.conf DEFAULT verbose True
openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_uri http://controller:5000
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_host controller
openstack-config --set /etc/cinder/cinder.conf keystone_authtokenauth_protocol http
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_user cinder
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_password cinder

openstack-config --set /etc/cinder/cinder.conf DEFAULT rpc_backend cinder.openstack.common.rpc.impl_kombu
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_host controller
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_password rabbitmq_pwd

openstack-config --set /etc/cinder/cinder.conf database connection mysql://mysql_cinder_user:mysql_cinder_pwd@controller/cinder

openstack-config --set /etc/cinder/cinder.conf DEFAULT glance_host controller

openstack-config --set /etc/cinder/cinder.conf DEFAULT my_ip private_ip

openstack-config --set /etc/cinder/cinder.conf DEFAULT iscsi_helper lioadm

echo 'include /etc/cinder/volumes/*' >> /etc/tgt/targets.conf

systemctl enable openstack-cinder-volume.service target.service
systemctl start openstack-cinder-volume.service target.service